package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmCaseMapper;
import com.cm.caseManagement.pojo.entity.CmCase;
import com.cm.caseManagement.service.ICmCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 案件Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmCaseServiceImpl implements ICmCaseService
{
    @Autowired
    private CmCaseMapper cmCaseMapper;

    /**
     * 查询案件
     *
     * @param id 案件主键
     * @return 案件
     */
    @Override
    public CmCase selectCmCaseById(Long id)
    {
        return cmCaseMapper.selectCmCaseById(id);
    }

    /**
     * 查询案件列表
     *
     * @param cmCase 案件
     * @return 案件
     */
    @Override
    public List<CmCase> selectCmCaseList(CmCase cmCase)
    {
        return cmCaseMapper.selectCmCaseList(cmCase);
    }

    /**
     * 新增案件
     *
     * @param cmCase 案件
     * @return 结果
     */
    @Override
    public int insertCmCase(CmCase cmCase)
    {
        cmCase.setCreateTime(DateUtils.getNowDate());
        return cmCaseMapper.insertCmCase(cmCase);
    }

    /**
     * 修改案件
     *
     * @param cmCase 案件
     * @return 结果
     */
    @Override
    public int updateCmCase(CmCase cmCase)
    {
        cmCase.setUpdateTime(DateUtils.getNowDate());
        return cmCaseMapper.updateCmCase(cmCase);
    }

    /**
     * 批量删除案件
     *
     * @param ids 需要删除的案件主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseByIds(Long[] ids)
    {
        return cmCaseMapper.deleteCmCaseByIds(ids);
    }

    /**
     * 删除案件信息
     *
     * @param id 案件主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseById(Long id)
    {
        return cmCaseMapper.deleteCmCaseById(id);
    }
}
